﻿
using MediatR;
using Microsoft.AspNetCore.Mvc;
using S.Archives.Read.Api.Application.Command.Total;

namespace S.Archives.Read.Api.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class TotalController : ControllerBase
    {
        private IMediator mediator;
        public TotalController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 种母存栏结构
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        /// 
        [HttpGet("SeedMotherColumn")]
        public async Task<IActionResult> SeedMotherColumn(int id)
        {
            var result = await mediator.Send(new SeedMotherColumnComand() { Variety = id });
            return Ok(result);
        }
      /// <summary>
      /// 近三十日存栏趋势
      /// </summary>
      /// <returns></returns>
        [HttpGet("SaveColumnTrend")]
        public async Task<IActionResult> SaveColumnTrend()
        {
            var result = await mediator.Send(new SaveColumnTrendCommand());
            return Ok(result);
        }
        /// <summary>
        /// 羊场实时存栏
        /// </summary>
        /// <param name="id">0-全部1-种公2-种母3-后裔</param>
        /// <returns></returns>
        [HttpGet("RealTimeColumn")]
        public async Task<IActionResult> RealTimeColumn(int id)
        {
            var result = await mediator.Send(new RealTimeColumnCommand() { Id=id});
            return Ok(result);
        }
        /// <summary>
        /// 近30日淘汰趋势
        /// </summary>
        /// <returns></returns>
        [HttpGet("EliminationTrend")]
        public async Task<IActionResult> EliminationTrend()
        {
            var result = await mediator.Send(new EliminationTrendCommand());
            return Ok(result);
        }
        /// <summary>
        /// 近30日死亡趋势
        /// </summary>
        /// <returns></returns>
        [HttpGet("DeathTrend")]
        public async Task<IActionResult> DeathTrend()
        {
            var result = await mediator.Send(new DeathTrendCommand());
            return Ok(result);
        }

        





    }
}
